package com.lh.tams.controller.system;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lh.tams.domain.TamsMaxLaw;
import com.lh.tams.service.system.LawMaxService;
import com.lh.tams.util.DataGridModel;
import com.lh.tams.util.ID;
import com.lh.tams.util.Page;
import com.lh.tams.util.Status;
import com.lh.tams.util.diy.Json;

/**
 * 法律法规大类管理controller
 * @author liulin
 * @version 2012-06-20
 */
@RequestMapping("/lawmax")
@Controller
public class LawMaxController {
	private LawMaxService lawMaxService;

	public LawMaxService getLawMaxService() {
		return lawMaxService;
	}

	public void setLawMaxService(LawMaxService lawMaxService) {
		this.lawMaxService = lawMaxService;
	}

	@RequestMapping("/query.adm")
	@ResponseBody
	public Page query(DataGridModel dgm,TamsMaxLaw tamsMaxLaw){
		return lawMaxService.query(dgm, tamsMaxLaw);
	}
	
	@RequestMapping("/add.adm")
	@ResponseBody
	public Json add(TamsMaxLaw tamsMaxLaw){
		
		tamsMaxLaw.setIdBgt(ID.next());
		tamsMaxLaw.setStatus(Status.STATUS_NORMAL);
		lawMaxService.add(tamsMaxLaw);
		Json json = new Json();
		return json;
	}
	
	@RequestMapping("/update.adm")
	@ResponseBody
	public Json update(TamsMaxLaw tamsMaxLaw){
		tamsMaxLaw.setStatus(Status.STATUS_NORMAL);
		lawMaxService.update(tamsMaxLaw);
		Json json = new Json();
		return json;
	}
	
	@RequestMapping("/del.adm")
	@ResponseBody
	public Json delete(long[] id){
		lawMaxService.delete(id);
		return new Json();
	}
}
